#ifndef NOTE_H
#define NOTE_H
#include <QtCore/QMap>
#include <QtCore/QDate>
#include "globalPara.h"
#define DATE_FORMAT Qt::ISODate
class NoteItem
{
public:
    NoteItem();
    NoteItem(NoteType _type,QDate _date,QTime _time,QString _title,qint32 _prog,bool _bClocker,
             QTime _clockTime,QString _remark,QStringList _receiverList)
         :_NoteType(_type),_Date(_date),        _Time(_time),_Title(_title),
          _Progress(_prog),_bClock(_bClocker),  _ClockTime(_clockTime),
          _Remark(_remark), _ReceiverList(_receiverList)
    {
    }
    ~NoteItem();
private:
    NoteType _NoteType;
    QDate   _Date;
    QTime   _Time;
    QString _Title;
    qint32  _Progress;
    bool    _bClock;
    QTime   _ClockTime;
    QString _Remark;            //remark of note or task
    QStringList _ReceiverList;  //receiver name

public:
    void    clear();
    NoteType getNoteType();
    QDate   getDate();
    QTime   getTime();
    QString getTitle();
    qint32  getProgress();
    bool    getClocker();
    QTime   getClockTime();
    QString getRemark();
    QStringList getReceiver();
    void    setNoteType(NoteType _type);
    void    setDate(QDate _date);
    void    setTime(QTime _time);
    void    setTitle(QString _title);
    void    setProgress(qint32 _progress = 0);
    void    setClocker(bool _clockFlag = true);
    void    setClockTime(QTime _clockTime);
    void    setRemark(QString _remark);
    void    setReceiver(QStringList _receiver);
    void    addReveiver(QString _oneReceiver);
};

//conserve all item of one day,key is the index starts from 0;
class NoteItemOneDay
{
public:
    NoteItemOneDay();
    ~NoteItemOneDay();

    void    clear();//delete all elements of _itemsOneDay.
    void    addItem(NoteItem _item);
    void    addItem(QString _key,NoteItem _item);
    void    deleteItem(QTime _key);
    void    deleteItemByTitle(QString _title);
    void    updateItem(QTime _key,NoteItem _item);

    NoteItem getItem(QTime _key);
    NoteItem getItemByTitle(QString _title);
    NoteItem getTopItem();
    NoteItem getBottomItem();
    qint32  getSize();
    QMap<QString,NoteItem>::const_iterator constBegin();
    QMap<QString,NoteItem>::const_iterator constEnd();

private:
    QMap<QString,NoteItem> _itemsOneDay;
};

//conserve all items,the key is date
class NoteItemMap
{
public:
    NoteItemMap();
    ~NoteItemMap();

private:
    QMap<QString,NoteItemOneDay> _itemMap;//key is QString from QDate


public:
    void    addItemOneDay(NoteItemOneDay _item);
    void    deleteItemOneDay(QDate _date);
//    void    updateItem(qint32 _key,NoteItem _item);
    bool getItemOneDay(QDate _date,NoteItemOneDay &_itemOneday);
    QMap<QString,NoteItemOneDay>::const_iterator constBegin();
    QMap<QString,NoteItemOneDay>::const_iterator constEnd();
    qint32  getSize();
    void    clear();
};

#endif // NOTE_H
